package com.coder.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="user")
public class User {
	
	private Integer id;
	private String username;
	private String password;
	private String email;
	private Boolean isDeleted;
	private String validCode;
	private Date validDate;
	private Date registerDate;
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)  
	@Column(name="userid",nullable = false)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name="username",nullable=false)
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	
	@Column(name="password",nullable=false)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	@Column(name="email")
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(name="isdeleted")
	public Boolean getIsDeleted() {
		return isDeleted;
	}
	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}
	
	@Column(name="validcode")
	public String getValidCode() {
		return validCode;
	}
	public void setValidCode(String validCode) {
		this.validCode = validCode;
	}
	
	@Column(name = "registerdate", nullable = false)
	public Date getRegisterDate() {
		return registerDate;
	}
	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	
	@Column(name="validdate")
	public Date getValidDate() {
		return validDate;
	}
	
	public void setValidDate(Date validDate) {
		this.validDate = validDate;
	}
	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password="
				+ password + ", email=" + email + ", isDeleted=" + isDeleted
				+ ", validCode=" + validCode + ", validDate=" + validDate
				+ ", registerDate=" + registerDate + "]";
	}
	
	@Override
	public User clone() throws CloneNotSupportedException {
		User newUser = new User();
		newUser.setEmail(this.email);
		newUser.setId(this.id);
		newUser.setIsDeleted(this.isDeleted);
		newUser.setPassword(this.password);
		newUser.setRegisterDate(this.registerDate);
		newUser.setUsername(this.username);
		newUser.setValidCode(this.validCode);
		newUser.setValidDate(this.validDate);
		return newUser;
	}
}
